package com.sishu.websocket4.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sishu.websocket4.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {


//
//    @Insert("insert into ${user} (uid, name, point) values (#{uid}, #{name}, #{point})")
//    void insertuser( User user);


//    @Insert("INSERT INTO usertest (uid, password, point) VALUES (#{uid}, #{passworld}, #{point}) " +
//            "ON DUPLICATE KEY UPDATE point = VALUES(point)")
//    void insertOrUpdateusertest(User user);


//    @Insert("INSERT INTO usertest (username,password, point) VALUES (#{username}, #{password}, #{point}) ")
//    void insertusertest(User user);

    @Select("select * from usertest  where username = #{username} and password = #{password}")
    User selectByname(String username, String password);

//    @Insert("INSERT INTO usertest (id,uid,username,password, point) VALUES (#{id},#{uid},#{username}, #{password}, #{point}) ")
//    void insertusertest(User user);

    @Insert("INSERT INTO Users (user_id,user_name, user_type) VALUES (#{userId},#{userName},#{userType}) ")
//            "ON DUPLICATE KEY UPDATE point = VALUES(point)")
    void insertusers(User user);


    @Select("select user_name from Users where user_id = #{userId}")
    String selectByuserId(String userId);

    @Select("select * from Users where user_id = #{userId}")
    User selectbyUserId(String userId);

    @Select("select * from Users")
    List<User> selectAll();




}
